<template>
    <el-button @click="resetForm" type="warning" ><el-icon><Refresh /></el-icon>重置</el-button>
</template>
<script>
export default {
   props: {
    queryParams:Object,
   },
  data(){
    return{
      
    }
  },
  methods: {
    // 重置表单
    resetForm(){
      for (let key in this.queryParams) {
        //分页参数不能重置
        if (key != 'pageNo' && key != 'pageSize') {
          // 如果是数组 , 则重置为空数组, 否则重置为空字符串
          if (this.isArray(this.queryParams[key])) {
            this.queryParams[key] = []
          } else {
            this.queryParams[key] = ''
          }
        }
      }
    },
    // 判断value是否为对象类型
    isObject(data){
        let type = Object.prototype.toString.call(data)
        return type == '[object Object]'

    },
    // 判断value是数组类型
    isArray(data){
        let type = Object.prototype.toString.call(data)
        return type == '[object Array]'
    },
  }
}
</script>